<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>腾飞健康管理平台</title>
    <link rel="stylesheet" href="lib/layui/css/layui.css">
</head>
<body>
<div style="padding-left: 80px;padding-right:80px;padding-top: 30px">
    <form class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" lay-verify="required" name="examinerName">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">身份证号</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" lay-verify="required|identity" name="idNumber">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">可用邮箱</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" lay-verify="required|email" name="email">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block" style="padding-left: 10%;">
                <button type="submit" name="submit" class="layui-btn" lay-submit=""
                        lay-filter="submitValue">立即提交
                </button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>

<script src="lib/layui/layui.js"></script>
<script type="text/javascript">
    layui.use(["jquery", "form"], function () {
        let $ = layui.jquery;
        let form = layui.form;

        form.on("submit(submitValue)", function (data) {
            var loadIndex;
            $.ajax({
                url: "/findExaminerPwd",
                dataType: "json",
                data: data.field,
                type: "post",
                before: function(){
                    console.log("等待");
                    loadIndex = layer.load(0, {shade: 0.3});
                },
                success: function(responseResult){
                    if(responseResult.code==1){
                        layer.msg(responseResult.msg, {
                            icon: 1,
                            time: 1500
                        });
                    }else{
                        layer.msg(responseResult.msg, {
                            icon: 2,
                            time: 1500
                        });
                    }
                },
                error: function(){
                    console.log("找回密码请求失败！");
                    layer.msg("服务器错误！", {
                        icon: 2,
                        time: 1500
                    });
                },
                complete: function () {
                    layer.close(loadIndex);
                },
            });
            return false;
        });

    });
</script>
</body>
</html>